/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.capex.javaee.applets;

import java.applet.Applet;
import java.awt.event.*;
import java.awt.*;

public class Myapp extends Applet implements ActionListener {

    Label lab;
    TextField tft1, tft2;
    Button btnresult;

    @Override
    public void init() {
        lab = new Label("Enter a number");
        tft1 = new TextField(5);
        tft2 = new TextField(5);
        btnresult = new Button("Double is");
        btnresult.addActionListener(this);
        add(lab);
        add(tft1);
        add(btnresult);
        add(tft2);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if(e.getSource() == btnresult){
            int num = Integer.parseInt(tft1.getText()) * 2;
            tft2.setText(String.valueOf(num));
        }
    }
}
